//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.view.components
{
	import flash.events.Event;
	
	import mx.core.Window;
	
	import reader.core.IReaderWindow;
	import reader.core.WindowManager;

	public class TypedWindow extends Window implements IReaderWindow
	{
		//////////////////////////////////////////////////////////////////////////////
		//Public properties

		[Bindable]
		public var windowType:String;

		//////////////////////////////////////////////////////////////////////////////
		//Constructor
		public function TypedWindow()
		{
			super();
			this.addEventListener(Event.CLOSE, onWindowClode_handler);			
		}
		
		//////////////////////////////////////////////////////////////////////////////
		//methods
		override public function close():void
		{			
			WindowManager.unRegisterWindow(this);			
			super.close();
		}
		
		//////////////////////////////////////////////////////////////////////////////
		//events
		private function onWindowClode_handler(e:Event):void
		{
			this.removeEventListener(Event.CLOSE, close);
			this.close();
		}
		
	}
}

